const mongoose = require('mongoose');
// const LoginSchema = mongoose.model('LoginSchema');
const peopleLoginModel=mongoose.model('peopleLoginModel')

module.exports.register=async function({newname,newPass,nickname}){
         const data=await peopleLoginModel.find({newname});
         if(data.length>0){
             return {
                 msg:'该账户已存在',
                 success:false
             };
         }else{
           //  console.log('第三层',newname,newPass,nickname);
             return await peopleLoginModel.create({name:newname,password:newPass,nickname})
         }
}
module.exports.login=async function({loginName}){
    const name=loginName;
    return await peopleLoginModel.find({name})
}